package com.woniu.woniuproject.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.woniuproject.entity.Debt_info;
import com.woniu.woniuproject.mapper.DebtinfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class Debt_infoService {
    @Autowired
    DebtinfoMapper debtinfoMapper;


    public int insert(Debt_info debtorInfo) {
        return debtinfoMapper.insert(debtorInfo);
    }

    public PageInfo selectList(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        List<Debt_info> list = debtinfoMapper.selectAll("贷款","未匹配");
        PageInfo<Debt_info> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    public int updateStatus(int Pid,Date date,Date date1) {
        return debtinfoMapper.updateStatus(Pid,date,date1);
    }

    public int updateunStatus(int Pid) {
        return debtinfoMapper.updateunStatus(Pid);
    }

    public Debt_info selectById(int Pid) {
        return debtinfoMapper.selectByPrimaryKey(Pid);
    }

    public PageInfo<Debt_info> selectApplyList(int currentPage, int pageSize, Date start, Date end) {
        PageHelper.startPage(currentPage,pageSize);
        List<Debt_info> list = debtinfoMapper.selectApplyList(start,end);
        PageInfo<Debt_info> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
